<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.tjsinfo.tjsoa.addresslist.vo.AddressListUser"%>
<%@page import="com.tjsinfo.tjsoa.addresslist.vo.AddressListAndFilePending"%>
<%@page import="java.text.SimpleDateFormat"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>粮油集团办公自动化协作平台</title>
    <meta http-equiv="x-ua-compatible" content="ie=7" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="<%=basePath%>style/txlz7.css" rel="stylesheet" type="text/css" id="txlz7"/>
	<link rel="stylesheet" type="text/css" href="<%=basePath%>ajaxFramework/ext-2.1/resources/css/ext-all.css" />
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
  	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script>
	<style type="text/css">
			td {
				font:12px/170% "宋体", "新宋体", "黑体"; color:#000
			}
			th {
				font:12px/170% "宋体", "新宋体", "黑体"; color:#000
			}
         .trBgColor { background-color:#A4D7E8; cursor: hand;}
	</style>
                
	<%
		List<AddressListAndFilePending> list = (List<AddressListAndFilePending>)request.getAttribute("list");
		int pagecount = 0;
		if(list.size() != 0){
			pagecount = list.size();
		}
		String listUser_id = (String)request.getAttribute("listUser_id");
		if(listUser_id == null)listUser_id = "-1";
	 %>
	 <script language="JavaScript" type="text/javascript" >//最大数据量
var total="<%=pagecount %>";
//每页的显示量
var pagesize="17";
//一共有多少页
var pagenum=Math.ceil(total/pagesize);
//生成导航
var nowpage = 1;
function initpage(nowpage){
var pagenav='<a>共'+total+'条,共'+pagenum+'页&nbsp;&nbsp;当前为'+nowpage+'页</a>&nbsp;&nbsp; <a>跳转到';
pagenav += '<select onchange="goToPage(this.value);">';
for(i=1;i<=pagenum;i++){
	if(i==nowpage){
		pagenav += '<option value="'+i+'" selected="selected">'+i+'</option>';
	}else{
		pagenav += '<option value="'+i+'">'+i+'</option>';
	}
}
pagenav += '</select>页</a>';
if(pagenum != 0){
document.getElementById('page').innerHTML=pagenav;
}
}
//翻页
function goToPage(page){
var start=(page-1)*pagesize;
var max=page*pagesize;
for(vs=0;vs<total;vs++){
var obj=document.getElementById('item_' + vs);
obj.style.display="none";
}
if(max>total)max=total;
for(v=start;v<max;v++){
var obj=document.getElementById('item_' + v);
obj.style.display="block";
}
initpage(page);
}
//上一页
function up(nowpage){
if(nowpage>1)goToPage((nowpage-1));
}
//下一页
function down(nowpage){
if(nowpage<pagenum)goToPage((nowpage+1));
}

window.onload = function(){
	initpage(1);
	var tb = new Ext.Toolbar(
		{
			height:25
		}
	);

    tb.render('menu');
	tb.addFill();
    tb.addText('<img id="windowResize" src="<%=basePath%>images/m_icon05.gif;"><a style="font-weight:bold; color:black;line-height: 22px;">通讯录请求</a>&nbsp;&nbsp;&nbsp;');
}
</script>
  </head>
  
  <body>
  <div id="right" style="z-index: 19;height: 98%;width: 99%">
      <div id="menu" style="padding-top:4px;"></div>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
      	<tr>
            <td width="100%" valign="top" height="100%">
               <div class="contab" style="height: 90%;width: 100%;margin-left: 0px;" >
                  <table class="p_06" width="100%" border="0" cellspacing="0" id="mytable">
                    <tr>
                        <th width="25%">类型</th>
                        <th width="25%">请求人</th>
                        <th width="25%">请求时间</th>
                        <th width="25%">链接</th>
                    </tr>
                    <%
                    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                    	int i = 0;
                    	for (AddressListAndFilePending listUser : list) {
					%>
					<tr onmouseover='this.className="trBgColor"' onmouseout='this.className=""' id="item_<%=i %>">
						<td><a><%=listUser.getTitle() %></a></td>
						<td><a><%=listUser.getSendUserName() %></a></td>
						<td><a><%=sdf.format(listUser.getCreateTime()) %></a></td>
						<td><a href="<%=listUser.getUrl() %>">点击</a></td>
					</tr>
					<%
						i++;
						}
                     %>
                      <tr align="center">
                        <td colspan="7">
                          <div class="pages" id="page">
                          </div>
                        </td>
                    </tr>
                 </table>
              </div>
            </td>
          </tr>
      </table>
     </div>
  </body>
  <script>
for(vs=1;vs<total;vs++){
	var obj=document.getElementById('item_' + vs);
	obj.style.display="none";
	for(v=1;v<pagesize;v++){
		if(vs==v){
			var obj=document.getElementById('item_' + vs);
			obj.style.display="block";
		}
	}
}
</script>
</html>
